import { createRouter, createWebHashHistory } from 'vue-router';
/* Layout */

const router = createRouter({
  history: createWebHashHistory(),
    routes: [
        // your routes here
        {
            path: '/',
            component: () => import('@/layouts/Layout.vue'),
            redirect: '/home',
            name: 'Layout',
            children: [
                {
                    path: '/home',
                    component: () => import('@/pages/Home.vue'),
                    redirect: '/main',
                    name: 'Home',
                    children:[
                        {
                            path:'/main',
                            component:()=> import('@/pages/home/PostList.vue')
                        },
                        {
                            path:'/tags',
                            component:()=> import('@/pages/home/PostTagsList.vue')
                        },
                        {
                            path:'/category',
                            component:()=>import('@/pages/home/PostCategoryList.vue')
                        }
                    ]
                },
                {
                    path: '/post',
                    component:()=> import('@/pages/MdDisplay.vue'),
                    name: 'postPreview',
                    meta: {
                        title: '文章详情',
                    }
                }
            ]
        },
        {
            path: '/admin',
            component: () => import('@/layouts/Admin.vue'),
            redirect: '/dashboard',
            children: [
                {
                    path: '/dashboard',
                    component:()=> import('@/pages/Dashboard.vue')
                },
                {
                    path: '/postList',
                    component: () => import('@/pages/AdminPostList.vue')
                },
                {
                    path: '/postEditor',
                    component: () => import('@/pages/MdEditor.vue')
                },
                {
                    path:'/setting',
                    component:() => import('@/pages/Setting.vue')
                }
            ]
        },
        {
            path:'/login',
            component:()=> import('@/layouts/Login.vue'),
        },
    ],
});
export default router